<template>
  <div>
    detail page :{{$route.params.id}}
    <img :src="movie.img|wh('120.80')" />

  </div>
</template>

<script>
import axios from "axios"

export default {
  filters: {
    wh(url, wh) {
      return url.replace(/w.h/, wh)
    }
  },
  mounted() {
    console.log(this)
  },
  async asyncData() {
    // console.log("asyncdata:")
    // let rs = await axios.get("/data/movie.json")
    // console.log(rs)
    // return {
    //   movie: rs.data
    // }

    return axios
      .get("/data/movie.json")
      .then(res => {
        return { movie: res.data }
      })
      .catch(e => {
        error({ statusCode: 404, message: "Post not found" })
      })
  }
}
</script>

